//
//  WRYVideoView.m
//  BaiSiBuJie
//
//  Created by wry on 16/5/6.
//  Copyright © 2016年 WRY. All rights reserved.
//

#import "WRYVideoView.h"

@interface WRYVideoView ()
@property (weak, nonatomic) IBOutlet UIButton *playBtn;
@property (weak, nonatomic) IBOutlet UILabel *playCountLabel;//次数
@property (weak, nonatomic) IBOutlet UIImageView *videoImageView;//图片
@property (weak, nonatomic) IBOutlet UILabel *videoLength;//时长


@end

@implementation WRYVideoView

-(void)setItem:(WRYThemeItem *)item
{
    [super setItem:item];
    //设置图片
    [WRYLoadImageManager wry_setImageToImageView:_videoImageView WithURL:item.image0 placeholderImage:nil progress:nil completed:nil];
    //播放次数
     NSString *count;
    if (item.playcount >=10000) {
        CGFloat num=1.0*item.playcount/10000;
        count =[NSString stringWithFormat:@"%.1f万次播放",num];
        count=[count stringByReplacingOccurrencesOfString:@".0" withString:@""];
    }else{
        count =[NSString stringWithFormat:@"%zd次播放",item.playcount];
    }
    _playCountLabel.text=count;
    //时长
    NSInteger min=item.videotime/60;
    NSInteger sec=item.videotime%60;
    NSString *length=[NSString stringWithFormat:@"%02zd:%02zd",min,sec];
    _videoLength.text=length;
}



@end
